package parse

import (
	"encoding/json"
	"fmt"
	"spider/models"
	"spider/models/meituan/meituanMeishiH5"
)

//解析列表页

func MeituanMeishiH5List(str []byte, dfp models.DataFromParent) (parseRequestResult models.ParseRequestResult, err error) {
	var (
		res meituanMeishiH5.ResLists
	)

	err = json.Unmarshal(str, &res)
	if err != nil {
		panic(err)
		return
	}

	fmt.Printf("%+v", res)
	return

}

/**
解析资质证照页
*/
func MeituanMeishiH5License(str []byte, dfp models.DataFromParent) (parseRequestResult models.ParseRequestResult, err error) {
	var (
		res meituanMeishiH5.ResLicence
		items []meituanMeishiH5.ResDataDetail
	)

	err = json.Unmarshal(str, &res)
	if err!=nil{
		return
	}
	items= append(items, res.Data)
	var requests  []models.Request

	parseRequestResult= models.ParseRequestResult{
		Items:items,
		Requests:requests,//没有下级的请求了,所以传空
	}
	return
}
